<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<title>M购物商场</title>
		<link rel="stylesheet" href="<%=request.getContextPath()%>/resources/css/bootstrap.min.css" type="text/css" />
		<script src="<%=request.getContextPath()%>/resources/js/jquery-1.11.3.min.js" type="text/javascript"></script>
		<script src="<%=request.getContextPath()%>/resources/js/bootstrap.min.js" type="text/javascript"></script>
		<script type="text/javascript" src="resources/js/jquery-heima-0.0.1.js" ></script>
		<script>
			$(function(){
				HM.ajax("<%=request.getContextPath()%>/productServlet","method=getHostAndNew",function(data){
					if(data.code==1){
						var host = data.obj.host;
						var news = data.obj.news;
						$.each(host, function(index,ele) {
							var str = "<div class=\"col-md-2 col-sm-4 col-xs-6\" style=\"text-align:center;height:200px;padding:10px 0px;\">\n" +
								      "\t\t\t\t\t\t<a href=\"<%=request.getContextPath()%>/productServlet?method=getOneProduct&pid="+ele.pid+"\">\n" +
								      "\t\t\t\t\t\t\t<img src=\""+ele.pimage+"\" width=\"130\" height=\"130\" style=\"display: inline-block;\">\n" +
								      "\t\t\t\t\t\t</a>\n" +
								      "\t\t\t\t\t\t<p><a href=\"<%=request.getContextPath()%>/productServlet?method=getOneProduct&pid="+ele.pid+"\" style='color:#666'>"+ele.pname+"</a></p>\n" +
								      "\t\t\t\t\t\t<p><font color=\"#E4393C\" style=\"font-size:16px\">&yen;"+ele.shop_price+"</font></p>\n" +
								      "\t\t\t\t\t</div>";
							$("#hostdiv").append(str);
						});
						
						$.each(news, function(index,ele) {
							var str = "<div class=\"col-md-2 col-sm-4 col-xs-6\" style=\"text-align:center;height:200px;padding:10px 0px;\">\n" +
								      "\t\t\t\t\t\t<a href=\"<%=request.getContextPath()%>/productServlet?method=getOneProduct&pid="+ele.pid+"\">\n" +
								      "\t\t\t\t\t\t\t<img src=\""+ele.pimage+"\" width=\"130\" height=\"130\" style=\"display: inline-block;\">\n" +
								      "\t\t\t\t\t\t</a>\n" +
								      "\t\t\t\t\t\t<p><a href=\"<%=request.getContextPath()%>/productServlet?method=getOneProduct&pid="+ele.pid+"\" style='color:#666'>"+ele.pname+"</a></p>\n" +
								      "\t\t\t\t\t\t<p><font color=\"#E4393C\" style=\"font-size:16px\">&yen;"+ele.shop_price+"</font></p>\n" +
								      "\t\t\t\t\t</div>";
							$("#newsdiv").append(str);
						});
						
					}
				});


				HM.ajax("<%=request.getContextPath()%>/posterServlet","method=showAll&admin=no",function(data){
					var o = data.obj;
					var str = "";
					var str2 = "";
					$.each(o, function(index,ele) {
						if(index==0){
							str2 += "<li data-target=\"#carousel-example-generic\" data-slide-to=\""+index+"\" class=\"active\"></li>";
							str+="<div class=\"item active\">\n" +
									"\t\t\t\t\t\t\t<a href=\"<%=request.getContextPath()%>/productServlet?method=getOneProduct&pid="+ele.pid+"\"><img width=\"1310px\" src=\"<%=request.getContextPath()%>/"+ele.pimage+"\"></a>\n" +
									"\t\t\t\t\t\t\t<div class=\"carousel-caption\">\n" +
									"\n" +
									"\t\t\t\t\t\t\t</div>\n" +
									"\t\t\t\t\t\t</div>";

						}else {
							str2 += "<li data-target=\"#carousel-example-generic\" data-slide-to=\""+index+"\"></li>";
							str+="<div class=\"item\">\n" +
									"\t\t\t\t\t\t\t<a href=\"<%=request.getContextPath()%>/productServlet?method=getOneProduct&pid="+ele.pid+"\"><img width=\"1310px\" src=\"<%=request.getContextPath()%>/"+ele.pimage+"\"></a>\n" +
									"\t\t\t\t\t\t\t<div class=\"carousel-caption\">\n" +
									"\n" +
									"\t\t\t\t\t\t\t</div>\n" +
									"\t\t\t\t\t\t</div>";
						}
					});
					$("#lunbotu").html(str);
					$("#ioid").html(str2);
				});

			});
		</script>
	</head>

	<body>
		<div class="container-fluid" style="max-width: 1370px;">
			<div id="header" style="min-height: 130px;"><jsp:include page="/header.jsp" /></div>
			<!--
            	描述：轮播条
            -->
			<div class="container-fluid">
				<div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
					<!-- Indicators -->
					<ol id="ioid" class="carousel-indicators">
						<li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
						<li data-target="#carousel-example-generic" data-slide-to="1"></li>
						<li data-target="#carousel-example-generic" data-slide-to="2"></li>
					</ol>

					<!-- Wrapper for slides -->
					<div id="lunbotu" class="carousel-inner" role="listbox">
						<div class="item active">
							<a href=""><img  src="<%=request.getContextPath()%>/resources/products/hao/error1.jpg"></a>
							<div class="carousel-caption">

							</div>
						</div>
						<div class="item">
							<a href=""><img src="<%=request.getContextPath()%>/resources/products/hao/error2.jpg"></a>
							<div class="carousel-caption">

							</div>
						</div>
						<div class="item">
							<a href=""><img src="<%=request.getContextPath()%>/resources/products/hao/error3.jpg"></a>
							<div class="carousel-caption">

							</div>
						</div>
					</div>

					<!-- Controls -->
					<a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
						<span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
						<span class="sr-only">Previous</span>
					</a>
					<a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
						<span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
						<span class="sr-only">Next</span>
					</a>
				</div>
			</div>
			<!--
            	描述：商品显示
            -->
			<div class="container-fluid">
				<div class="col-md-12">
					<h2>热门商品&nbsp;&nbsp;<img src="<%=request.getContextPath()%>/resources/img/title2.jpg"/></h2>
				</div>
				<div class="col-md-2 hidden-sm hidden-xs" style="border:1px solid #E7E7E7;border-right:0;padding:0;">
					<img src="<%=request.getContextPath()%>/resources/products/hao/big01.jpg" width="205" height="404" style="display: inline-block;"/>
				</div>
				<div class="col-md-10"  id="hostdiv">
					<div class="col-md-6 col-sm-12 hidden-xs" style="text-align:center;height:200px;padding:0px;">
						<a href="">
							<img src="<%=request.getContextPath()%>/resources/products/hao/middle01.jpg" width="516px" height="200px" style="display: inline-block;">
						</a>
					</div>
				</div>
			</div>
			<!--
            	描述：广告部分
            -->
            <div class="container-fluid">
				<img src="<%=request.getContextPath()%>/resources/products/hao/ad.jpg" width="100%"/>
			</div>
			<!--
            	描述：商品显示
            -->
			<div class="container-fluid">
				<div class="col-md-12">
					<h2>最新商品&nbsp;&nbsp;<img src="<%=request.getContextPath()%>/resources/img/title2.jpg"/></h2>
				</div>
				<div class="col-md-2 hidden-sm hidden-xs" style="border:1px solid #E7E7E7;border-right:0;padding:0;">
					<img src="<%=request.getContextPath()%>/resources/products/hao/big01.jpg" width="205" height="404" style="display: inline-block;"/>
				</div>
				<div class="col-md-10" id="newsdiv">
					<div class="col-md-6 col-sm-12 hidden-xs" style="text-align:center;height:200px;padding:0px;">
						<a href="">
							<img src="<%=request.getContextPath()%>/resources/products/hao/middle01.jpg" width="516px" height="200px" style="display: inline-block;">
						</a>
					</div>
				</div>
			</div>
			<div id="footer"  style="min-height: 203px;"><jsp:include page="foot.jsp" /></div>
		</div>
	</body>
</html>